package guda.house.web.action.front;

import guda.grape.autogen.common.page.BizResult;
import guda.house.biz.WxAccessBiz;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by well on 16/5/28.
 */
@Controller
@RequestMapping(value = "front")
public class MySuiteAction {

    @Autowired
    private WxAccessBiz wxAccessBiz;

    @RequestMapping(value = "mySuite.htm", method = RequestMethod.GET)
    public String bindSuite(HttpServletRequest request, ModelMap modelMap) {
        BizResult bizResult = wxAccessBiz.queryMySuite();
        if(bizResult.success) {
            modelMap.putAll(bizResult.data);
            return "front/mySuite.vm";
        }else{
            return "redirect:/front/error.htm?code=" + bizResult.code;
        }
    }


}
